#include"head.h"
#include"mouse.h"
void main()
{
	int archive=1;
	int pmode=0;
	struct cell all[11][19]={0};
	FILE *fp1,*fp2,*fp3,*fp4;
	int i,j;
	if(archive==0)
	{
		goto over;
	}
	if(archive==1)
	{
		if((fp1=fopen("c:\\test\\fp1.txt","rt"))==NULL)
		{
			printf("can't open fp1!");
			getch();
			exit(1);
		}
		else
		{
			for(i=0;i<11;i++)
			{
				for(j=0;j<19;j++)
				{
					fscanf(fp1,"%d %ld %d %ld %d %d %d %d %d %d %d %d %d ",
					all[i][j].a.cost,
					all[i][j].a.state,
					all[i][j].a.attack,
					all[i][j].a.move,
					all[i][j].a.defense,
					all[i][j].a.range,
					all[i][j].a.pnum,
					all[i][j].a.power,
					all[i][j].a.knum,
					all[i][j].a.destination[0],all[i][j].a.destination[1],
					all[i][j].a.fire,
					all[i][j].a.time,
					all[i][j].a.num);
					fprintf(fp1,"%d %d %d %d %d %d %d ",
					all[i][j].mine,
					all[i][j].ditch,
					all[i][j].land,
					all[i][j].pointkind,
					all[i][j].draw,
					all[i][j].x,
					all[i][j].y);
				}
			}
		//	fscanf(fp1,"%d",*pmode);
		}
		fclose(fp1);
	}
	if(archive==2)
	{ 
			if((fp2=fopen("fp2.txt","r"))==NULL)
			{
				printf("can't open fp2!");
				getch();
				exit(1);
			}
			else
			{
				for(i=0;i<11;i++)
				{
					for(j=0;j<19;j++)
					{
						fscanf(fp2,"%d %ld %d %ld %d %d %d %d %d %d %d %d %d ",
					all[i][j].a.cost,
					all[i][j].a.state,
					all[i][j].a.attack,
					all[i][j].a.move,
					all[i][j].a.defense,
					all[i][j].a.range,
					all[i][j].a.pnum,
					all[i][j].a.power,
					all[i][j].a.knum,
					all[i][j].a.destination[0],all[i][j].a.destination[1],
					all[i][j].a.fire,
					all[i][j].a.time,
					all[i][j].a.num);
					fprintf(fp2,"%d %d %d %d %d %d %d ",
					all[i][j].mine,
					all[i][j].ditch,
					all[i][j].land,
					all[i][j].pointkind,
					all[i][j].draw,
					all[i][j].x,
					all[i][j].y);
					}
				}
			//	fscanf(fp2,"%d",*pmode);
			}
			fclose(fp2);
	}
	if(archive==3)
	{
		if((fp3=fopen("fp3.txt","r"))==NULL)
		{
			printf("can't open fp3!");
			getch();
			exit(1);
		}
		else
		{
			for(i=0;i<11;i++)
			{
				for(j=0;j<19;j++)
				{
					fscanf(fp3,"%d %ld %d %ld %d %d %d %d %d %d %d %d %d ",
					all[i][j].a.cost,
					all[i][j].a.state,
					all[i][j].a.attack,
					all[i][j].a.move,
					all[i][j].a.defense,
					all[i][j].a.range,
					all[i][j].a.pnum,
					all[i][j].a.power,
					all[i][j].a.knum,
					all[i][j].a.destination[0],all[i][j].a.destination[1],
					all[i][j].a.fire,
					all[i][j].a.time,
					all[i][j].a.num);
					fprintf(fp3,"%d %d %d %d %d %d %d ",
					all[i][j].mine,
					all[i][j].ditch,
					all[i][j].land,
					all[i][j].pointkind,
					all[i][j].draw,
					all[i][j].x,
					all[i][j].y);
				}
			}
		//	fscanf(fp3,"%d",*pmode);
		}
		fclose(fp3);
	}
	if(archive==4)
	{
		if((fp3=fopen("fp4.txt","r"))==NULL)
		{
			printf("can't open fp4!");
			getch();
			exit(1);
		}
		else
		{
			for(i=0;i<11;i++)
			{
				for(j=0;j<19;j++)
				{
					fscanf(fp4,"%d %ld %d %ld %d %d %d %d %d %d %d %d %d ",
					all[i][j].a.cost,
					all[i][j].a.state,
					all[i][j].a.attack,
					all[i][j].a.move,
					all[i][j].a.defense,
					all[i][j].a.range,
					all[i][j].a.pnum,
					all[i][j].a.power,
					all[i][j].a.knum,
					all[i][j].a.destination[0],all[i][j].a.destination[1],
					all[i][j].a.fire,
					all[i][j].a.time,
					all[i][j].a.num);
					fprintf(fp4,"%d %d %d %d %d %d %d ",
					all[i][j].mine,
					all[i][j].ditch,
					all[i][j].land,
					all[i][j].pointkind,
					all[i][j].draw,
					all[i][j].x,
					all[i][j].y);
				}
			}
		//	fscanf(fp4,"%d",*pmode);
		}
		fclose(fp4);
	}
	over:
}

